package com.tang.chat.utils;

import com.alibaba.fastjson2.JSON;
import com.tang.chat.pojo.ResultMessage;

/**
 * @author tmh
 * @date 2024/5/5 15:49
 * @description
 */
public class MessageUtil {

    public static String getMessage(boolean isSystemMessage, String fromName, Object message) {
        ResultMessage result = new ResultMessage();
        result.setSystemMessage(isSystemMessage);
        result.setMessage(message);
        if (fromName != null) {
            result.setFromName(fromName);
        }
        return JSON.toJSONString(result);
    }
}
